# coding: UTF-8

def display():
    print("+---+---+---+")
    cell_line = "|"
    for i in range(9):
        cell_line += " " + cells[i] + " |"
        if i % 3 == 2:
            print(cell_line)
            cell_line = "|"
            print("+---+---+---+")

if __name__ == '__main__':
    cells = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
    for i in range(9):
        row = input("Rows? : ")
        column = input("Column? : ")
        cells[(row - 1) * 3 + (column - 1)] = "O"
        display()
